const
    express = require('express'),
    app = express(),
    bodyParser = require('body-parser'),
    md5 = require('blueimp-md5'),
    session = require('express-session');


//引入路由:

const
    index = require('./routers/index'),
    user = require('./routers/user'),
    article = require('./routers/article');

//配置session中间件:
app.use(session({
    secret: 'itcast',
    resave: false,
    saveUninitialized: true
  }))

//配置模板引擎:
app.set('view engine', 'ejs')
app.set('views', './views')
app.use('/node_modules', express.static('./node_modules'))

app.use(bodyParser.urlencoded({
    extended: false
}))
app.use(bodyParser.json())


//启用路由：
app.use(index);
app.use('/user', user);
app.use('/article',article);




app.listen(8000);